<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
      <el-form-item label="BCR编号" prop="bcr">
        <el-input
          v-model="queryParams.bcr"
          placeholder="请输入BCR编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
          style="width:160px;"
        />
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker
          v-model="dateRange"
          size="small"
          style="width: 350px"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="datetimerange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:WorkLog:export']"
        >导出</el-button>
      </el-col>
	    <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row> -->

    <el-table v-loading="loading" :data="BcrReadList" >
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
	    <el-table-column label="BCR编号" min-width="120" align="center" prop="bcr"  />
      <el-table-column label="总数量" min-width="120" align="center" prop="readSum"  />
      <el-table-column label="成功总数" min-width="120" align="center" prop="readSuccess"  />
      <el-table-column label="失败总数" min-width="120" align="center" prop="noRead"  />
      <el-table-column label="读码率(%)" min-width="120" align="center" prop="readRate"/>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  
  </div>

</template>

<script>
import { listBcrRead } from "@/api/system/WorkLog";
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme

export default {
  name: "BcrRead",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 跟踪日志表格数据
      BcrReadList: [],
        // 日期范围
        dateRange: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // BCR编号字典
      bcrOptions: [],
      //总数量
      readSumOptions: [],
      //成功总数
      readSuccessOptions: [],
      //失败总数
      noReadOptions: [],
      //读码率
      readRateOptions: [],

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        bcr: null,
        readSum: null,
        readSuccess: null,
        noRead: null,
        readRate: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("${column.dictType}").then(response => {
      this.bcrOptions = response.data;
    });
    this.getDicts("${column.dictType}").then(response => {
      this.readSumOptions = response.data;
    });
    this.getDicts("${column.dictType}").then(response => {
      this.readSuccessOptions = response.data;
    });
    this.getDicts("${column.dictType}").then(response => {
      this.noReadOptions = response.data;
    });
    this.getDicts("${column.dictType}").then(response => {
      this.readRateOptions = response.data;
    });
  },
  methods: {
    /** 查询跟踪日志列表 */
    getList() {
      this.loading = true;
          listBcrRead(this.addDateRange(this.queryParams, this.dateRange)).then(
        response => {       
        this.BcrReadList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

    

    // BCR编号字典翻译
    bcrFormat(row, column) {
      return this.selectDictLabel(this.bcrOptions, row.bcr);
    },
     readSumFormat(row, column) {
      return this.selectDictLabel(this.readSumOptions, row.readSum);
    },
     readSuccessFormat(row, column) {
      return this.selectDictLabel(this.readSuccessOptions, row.readSuccess);
    },
     noReadFormat(row, column) {
      return this.selectDictLabel(this.noReadOptions, row.noRead);
    },
     readRateFormat(row, column) {
      return this.selectDictLabel(this.readRateOptions, row.readRate);
    },
   
    // 表单重置
    reset() {
      this.form = {    
        creaTime: null,
        bcr: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
 
    /** 导出按钮操作 */
    // handleExport() {
    //   const queryParams = this.queryParams;
    //   this.$confirm('是否确认导出所有读码率汇总数据项?', "警告", {
    //       confirmButtonText: "确定",
    //       cancelButtonText: "取消",
    //       type: "warning"
    //     }).then(function() {
    //       return exportWorkLog(queryParams);
    //     }).then(response => {
    //       this.download(response.msg);
    //     }).catch(function() {});
    // }
  }
};
</script>
